package demo1;

import java.util.Stack;

public class Test {
    public static void main(String[] args) {


    }

    public static void main2(String[] args) {
        MyStack myStack = new MyStack();
        myStack.push(11);
        myStack.push(22);
        myStack.push(33);
        //System.out.println(myStack.pop());


    }

    public static void main1(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);//压栈
        stack.push(2);
        stack.push(3);
        System.out.println(stack.size());//获取栈中的元素个数——》3个
        stack.pop();//出栈
        System.out.println(stack.peek());//获取栈顶元素，此时是2
        stack.pop();
        stack.pop();
        //判断栈是否为空，此时元素全部出栈，输出true
        System.out.println(stack.empty());
    }
}
